<template>
	<view class="container">
		<!-- 顶部标题 -->
		<view class="header">
			<text class="title">每日任务</text>
			<text class="subtitle">完成任务获取更多答题卡</text>
		</view>
		
		<!-- 每日任务 -->
		<view class="task-section">
			<view class="task-card">
				<view class="task-content">
					<view class="task-info">
						<text class="task-title">每日签到</text>
						<text class="task-desc">每日签到可获得1张答题卡</text>
					</view>
					<button class="task-button primary" @click="goToSignin">去签到</button>
				</view>
			</view>
			
			<view class="task-card">
				<view class="task-content">
					<view class="task-info">
						<text class="task-title">观看广告</text>
						<text class="task-desc">今日已完成 2/5 次</text>
					</view>
					<button class="task-button primary" @click="watchAd">去观看</button>
				</view>
			</view>
		</view>
		
		<!-- 可选任务 -->
		<view class="optional-tasks">
			<text class="section-title">可选任务</text>
			
			<view class="task-card">
				<view class="task-content">
					<view class="task-info">
						<text class="task-title">邀请3位好友</text>
						<text class="task-desc">进度: <text class="progress-text">2/3</text></text>
					</view>
					<view class="task-action">
						<text class="reward-text">奖励: 6张答题卡</text>
						<button class="task-button orange" @click="inviteFriends">去邀请</button>
					</view>
				</view>
			</view>
			
			<view class="task-card">
				<view class="task-content">
					<view class="task-info">
						<text class="task-title">邀请5位好友</text>
						<text class="task-desc">进度: <text class="progress-text">2/5</text></text>
					</view>
					<view class="task-action">
						<text class="reward-text">奖励: 15张答题卡</text>
						<button class="task-button orange" @click="inviteFriends">去邀请</button>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				dailyTasks: [
					{
						title: '每日签到',
						desc: '每日签到可获得1张答题卡',
						action: '去签到',
						completed: false
					},
					{
						title: '观看广告',
						desc: '今日已完成 2/5 次',
						action: '去观看',
						completed: false
					}
				],
				optionalTasks: [
					{
						title: '邀请3位好友',
						progress: '2/3',
						reward: '6张答题卡',
						action: '去邀请'
					},
					{
						title: '邀请5位好友',
						progress: '2/5',
						reward: '15张答题卡',
						action: '去邀请'
					}
				]
			}
		},
		methods: {
			goToSignin() {
				uni.switchTab({
					url: '/pages/signin/signin'
				});
			},
			watchAd() {
				uni.showToast({
					title: '正在加载广告',
					icon: 'none'
				});
			},
			inviteFriends() {
				uni.showToast({
					title: '正在生成邀请码',
					icon: 'none'
				});
			}
		}
	}
</script>

<style>
	.container {
		display: flex;
		flex-direction: column;
		background-image: linear-gradient(135deg, #67b3ff 0%, #ffffff 100%);
		min-height: 100vh;
		padding: 20rpx;
	}
	
	/* 顶部标题 */
	.header {
		display: flex;
		flex-direction: column;
		align-items: center;
		padding: 60rpx 0 40rpx 0;
	}
	
	.title {
		font-size: 36rpx;
		font-weight: bold;
		color: #333;
	}
	
	.subtitle {
		font-size: 24rpx;
		color: #666;
		margin-top: 10rpx;
	}
	
	/* 任务卡片 */
	.task-section, .optional-tasks {
		padding: 0 20rpx;
		margin-bottom: 40rpx;
	}
	
	.section-title {
		font-size: 32rpx;
		font-weight: 600;
		color: #333;
		margin-bottom: 20rpx;
		display: block;
	}
	
	.task-card {
		background-color: white;
		border-radius: 16rpx;
		padding: 20rpx;
		margin-bottom: 20rpx;
		box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.05);
	}
	
	.task-content {
		display: flex;
		justify-content: space-between;
		align-items: center;
	}
	
	.task-info {
		flex: 1;
	}
	
	.task-title {
		font-size: 28rpx;
		font-weight: 500;
		color: #333;
		margin-bottom: 12rpx;
	}
	
	.task-desc {
		font-size: 22rpx;
		color: #999;
		margin-top: 8rpx;
	}
	
	.task-button {
		font-size: 24rpx;
		padding: 10rpx 20rpx;
		border-radius: 8rpx;
		color: white;
		border: none;
		min-width: 120rpx;
		text-align: center;
	}
	
	.task-button.primary {
		background-color: #3b82f6;
	}
	
	.task-button.orange {
		background-color: #f97316;
	}
	
	.progress-text {
		color: #3b82f6;
	}
	
	.task-action {
		display: flex;
		flex-direction: column;
		align-items: flex-end;
	}
	
	.reward-text {
		font-size: 22rpx;
		color: #f97316;
		margin-bottom: 8rpx;
	}
</style> 